package com.wondream.myframework.thread;

import java.util.concurrent.FutureTask;

/**
 * 第三种创建线程的方式-实现Callble接口
 */
public class ThreadTest6 {
    public static void main(String[] args) throws Exception {
        int a = 1;
        int b = 1;
        FutureTask<Integer> integerFutureTask = new FutureTask<>(() -> a + b);
        new Thread(integerFutureTask).start();
        System.out.println(integerFutureTask.get());
    }

}
